import request from '@/config/axios'

// 删除项目
export const deleteProject = async (data) => {
  return await request.delete({ url: '/system/project/delete?id=' + data.id })
}

// 获取随机项目ID
export const getProjectCode = async () => {
  return await request.post({ url: '/system/project/code' })
}

// 创建项目
export const createProject = async (data) => {
  return await request.post({ url: '/system/project/create', data })
}
// 更新项目
export const updateProject = async (data) => {
  return await request.put({ url: '/system/project/update', data })
}
// 获取项目信息
export const getProjectInfo = async (params) => {
  return await request.get({ url: '/system/project/get', params })
}
// 获取项目列表
export const getProjectList = async (params) => {
  return await request.get({ url: '/system/project/page', params })
}

// 项目用户管理-列表查询
export const getProjectGroupList = async (params) => {
  return await request.get({ url: '/system/project/group/page', params })
}

// 项目用户管理-新建用户组
export const createProjectGroup = async (data) => {
  return await request.post({ url: '/system/project/group/create', data })
}
// 项目用户管理-更新用户组
export const updateProjectGroup = async (data) => {
  return await request.put({ url: '/system/project/group/update', data })
}
// 项目用户管理-删除用户组
export const deleteProjectGroup = async (data) => {
  return await request.delete({ url: `/system/project/group/delete?id=${data.id}&projectId=${data.projectId}` })
}
// 项目用户管理-获取非用户组的用户信息
export const getProjectGroupInfo = async (params) => {
  return await request.get({ url: '/system/project/group/member/list', params })
}
// 项目用户管理-获取用户组成员
export const getProjectGroupMember = async (params) => {
  return await request.get({ url: '/system/project/group/member/page', params })
}
// 项目用户管理-添加用户组成员
export const createProjectGroupMember = async (data) => {
  return await request.post({ url: '/system/project/group/member/create', data })
}
// 项目用户管理-删除用户组成员
export const deleteProjectGroupMember = async (data) => {
  return await request.delete({ url: `/system/project/group/member/delete?id=${data.id}&projectId=${data.projectId}&groupId=${data.groupId}` })
}
// 项目仓库管理/获取用户组
export const getProjectGroupStore = async (params) => {
  return await request.get({ url: '/system/project/store/groups', params })
}
// 项目仓库管理/新增仓库
export const createProjectStore = async (data) => {
  return await request.post({ url: '/system/project/store/create', data })
}
// 项目仓库管理/更新接口
export const updateProjectStore = async (data) => {
  return await request.put({ url: '/system/project/store/update', data })
}
// 项目仓库管理/仓库列表
export const getProjectStoreList = async (params) => {
  return await request.get({ url: '/system/project/store/page', params })
}
// 项目仓库管理/删除仓库
export const deleteProjectStore = async (data) => {
  return await request.delete({ url: `/system/project/store/delete?id=${data.id}&projectId=${data.projectId}` })
}
// 项目成员/项目成员查询
export const getProjectMemberList = async (params) => {
  return await request.get({ url: '/project/member/page', params })
}
// 项目成员/添加项目成员
export const createProjectMember = async (data) => {
  return await request.post({ url: '/project/member/create', data })
}
// 项目成员/删除项目成员
export const deleteProjectMember = async (data) => {
  return await request.delete({ url: `/project/member/delete?id=${data.id}&projectId=${data.projectId}` })
}
// 项目成员/退出项目
export const getProjectMemberQuit = async (params) => {
  return await request.get({ url: '/project/member/quit', params })
}
// 项目成员/成员转移
export const updateProjectMember = async (data) => {
  return await request.put({ url: '/project/member/update', data })
}
// 项目成员/获取成员操作权限
export const getProjectMemberPermission = async (params) => {
  return await request.get({ url: '/project/member/permission', params })
}
// 项目成员/获取项目角色
export const getProjectRole = async () => {
  return await request.get({ url: '/project/member/roles' })
}
// 获取项目成员-精简
export const getProjectMemberSimple = async (params) => {
  return await request.get({ url: '/system/user/list-all-simple', params })
}
// 获取项目成员
export const getProjectMember = async (params) => {
  return await request.get({ url: '/project/member/users', params })
}
// 更新私人令牌
export const updateKey = async (data) => {
  return await request.put({ url: '/system/project/updateKey', data })
}
// 更新成员角色信息
export const updateMemberRole = async (data) => {
  return await request.put({ url: '/project/member/update', data })
}
// 获取项目模版列表
export const getProjectModuleList = async (params) => {
  return await request.get({ url: '/templateManager/formList', params })
}
// 创建项目模版
export const createProjectModule = async (data) => {
  return await request.post({ url: '/templateManager/addField', data })
}
// 获取字段类型
export const getfieldTypeList = async () => {
  return await request.get({ url: '/templateManager/getFieldType' })
}
// 获取使用场景
export const getuseSceneList = async () => {
  return await request.get({ url: '/templateManager/getUseScene' })
}
// 获取项目模版
export const getProjectModule = async (params) => {
  return await request.get({ url: '/templateManager/getSystemTemplateById', params })
}
// 更新项目模版
export const updateProjectModule = async (data) => {
  return await request.post({ url: '/templateManager/editField', data })
}
// 删除项目模版
export const deleteProjectModule = async (params) => {
  return await request.delete({ url: '/templateManager/deleteFieldById', params })
}
// 获取人员在项目中的角色
export const getProjectMemberRole = async (params) => {
  return await request.get({ url: '/project/member/role', params })
}